<template>
  <div class="work-detail-page">
    <!-- 顶部导航栏 -->
    <Header 
      @openRegister="showRegisterModal = true" 
      @openLogin="showLoginModal = true"
    />
    
    <div class="work-detail-container">
      <div class="work-detail-content-wrapper">
        <div class="work-detail-content">
          <!-- 左侧：作品大图 -->
          <div class="work-image-section">
            <div class="work-image-wrapper">
              <img :src="workData.src" :alt="workData.title" class="work-main-image">
              <div class="work-id">
                <img :src="idIcon" alt="ID" class="id-icon">
                <span>ID: {{ workData.id || $route.params.id }}</span>
              </div>
            </div>
            <div class="work-attribution">
              作者声明:内容由人工智能(AIGC)合成
            </div>
            
            <!-- 素材标签 -->
            <div class="material-tags-section">
              <div class="section-title">
                <img :src="pathIcon" alt="路径" class="path-icon">
                <span>素材标签</span>
              </div>
              <div class="tags-container">
                <span 
                  v-for="(tag, index) in tags" 
                  :key="index"
                  class="tag-item"
                >
                  {{ tag }}
                </span>
              </div>
            </div>
            
            <!-- 猜你喜欢 -->
            <div class="recommend-section">
              <div class="section-title">
                <img :src="pathIcon" alt="路径" class="path-icon">
                <span>猜你喜欢</span>
              </div>
              <div class="recommend-grid">
                <div 
                  v-for="(item, index) in recommendWorks" 
                  :key="index"
                  class="recommend-item"
                  @click="handleImageClick(item)"
                >
                  <div class="recommend-image-wrapper">
                    <img :src="item.src" :alt="item.title">
                  </div>
                  <div class="recommend-info">
                    <h3 class="recommend-title">{{ item.title }}</h3>
                    <div class="recommend-author-info">
                      <div v-if="item.author !== '300分享分'" class="recommend-author-avatar">
                        <img :src="authorAvatar" alt="头像">
                      </div>
                      <div class="recommend-author-details">
                        <template v-if="item.author === '300分享分'">
                          <span class="recommend-share-points">
                            <img :src="shareIcon" alt="金币" class="recommend-coin-icon">
                            300分享分
                          </span>
                        </template>
                        <template v-else>
                          <div class="recommend-author-name-row">
                            <span class="recommend-author-name">{{ item.author }}</span>
                          </div>
                          <div class="recommend-author-meta-row">
                            <span class="recommend-author-level">Lv.4</span>
                            <span class="recommend-author-role">资深设计师</span>
                          </div>
                        </template>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 该设计师的其他作品 -->
            <div class="recommend-section">
              <div class="section-title">
                <img :src="pathIcon" alt="路径" class="path-icon">
                <span>该设计师的作品</span>
              </div>
              <div class="recommend-grid">
                <div 
                  v-for="(item, index) in designerWorks" 
                  :key="index"
                  class="recommend-item"
                  @click="handleImageClick(item)"
                >
                  <div class="recommend-image-wrapper">
                    <img :src="item.src" :alt="item.title">
                  </div>
                  <div class="recommend-info">
                    <h3 class="recommend-title">{{ item.title }}</h3>
                    <div class="recommend-author-info">
                      <div v-if="item.author !== '300分享分'" class="recommend-author-avatar">
                        <img :src="authorAvatar" alt="头像">
                      </div>
                      <div class="recommend-author-details">
                        <template v-if="item.author === '300分享分'">
                          <span class="recommend-share-points">
                            <img :src="shareIcon" alt="金币" class="recommend-coin-icon">
                            300分享分
                          </span>
                        </template>
                        <template v-else>
                          <div class="recommend-author-name-row">
                            <span class="recommend-author-name">{{ item.author }}</span>
                          </div>
                          <div class="recommend-author-meta-row">
                            <span class="recommend-author-level">Lv.4</span>
                            <span class="recommend-author-role">资深设计师</span>
                          </div>
                        </template>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 右侧：作品信息 -->
          <div class="work-info-section">
          <div class="work-info-content">
            <!-- 面包屑导航 -->
            <div class="breadcrumb">
              <nuxt-link to="/">首页</nuxt-link>
              <span class="separator">></span>
              <span>海报设计</span>
            </div>
            <!-- 标题和投诉 -->
            <div class="work-header">
              <div class="work-id-title-wrapper">
                <span class="work-id-title">{{ workData.id || $route.params.id }}</span>
                <img 
                  :src="copyIcon" 
                  alt="复制" 
                  class="copy-btn" 
                  @click="handleCopyId"
                  title="复制ID"
                >
              </div>
              <div class="complain-link">
                <span>投诉</span>
              </div>
            </div>
            
            <h1 class="work-title">{{ workData.title || '中国传统龙年春节庆典标志字体创意' }}</h1>
            
            <!-- 共享分 -->
            <div class="share-points-info">
              <img :src="shareIcon" alt="共享分" class="share-icon">
              <span class="share-points-number">300</span>
              <span class="share-points-text">共享分</span>
            </div>

            <!-- 文件信息 -->
            <div class="file-info">
              <div class="info-item">
                <span class="info-label">格式</span>
                <span class="info-separator">|</span>
                <span class="info-value info-value-highlight">PSD</span>
              </div>
              <div class="info-item">
                <span class="info-label">软件版本</span>
                <span class="info-separator">|</span>
                <span class="info-value">PS 2020</span>
              </div>
              <div class="info-item">
                <span class="info-label">大小</span>
                <span class="info-separator">|</span>
                <span class="info-value">40 M</span>
              </div>
              <div class="info-item">
                <span class="info-label">授权协议</span>
                <span class="info-separator">|</span>
                <span class="info-value">知识共享© CC-BY-NC</span>
              </div>
            </div>

            <!-- 操作按钮 -->
            <div class="action-buttons">
              <button class="download-btn" @click="handleDownload">
                立即下载
              </button>
              <button class="collect-btn" @click="handleCollect">
                收藏
              </button>
            </div>

            <!-- 提示信息 -->
            <div class="tips-box">
              <span class="tips-label">Tips:</span> 下载消耗积分可以通过上传作品的方式获得,并可能获得额外收益。
            </div>

            <!-- 票根装饰 -->
            <div class="ticket-divider"></div>

            <!-- 作者信息 -->
            <div class="author-section">
              <div class="author-header">
                <img :src="authorAvatar" alt="作者头像" class="author-avatar-large">
                <div class="author-info">
                  <div class="author-name-large">{{ workData.author || '烟雨下扬州' }}</div>
                  <div class="author-meta-row">
                    <div class="author-level-wrapper">
                      <span class="author-level">Lv.4</span>
                      <span class="author-role">资深设计师</span>
                    </div>
                    <button class="follow-btn">关注</button>
                  </div>
                </div>
              </div>
            <div class="author-stats">
              <div class="stat-item-wrapper">
                <div class="stat-number">99999</div>
                <div class="stat-label">作品</div>
              </div>
              <img :src="dividerIcon" alt="分隔符" class="stat-divider">
              <div class="stat-item-wrapper">
                <div class="stat-number">3636</div>
                <div class="stat-label">关注</div>
              </div>
              <img :src="dividerIcon" alt="分隔符" class="stat-divider">
              <div class="stat-item-wrapper">
                <div class="stat-number">3666</div>
                <div class="stat-label">粉丝</div>
              </div>
            </div>
            </div>
          </div>

          <!-- 广告位 -->
          <div v-if="showAdBanner" class="ad-banner">
            <img :src="adBannerIcon" alt="广告位" class="ad-image">
            <button class="ad-close-btn" @click="closeAdBanner">
              <img :src="closeIcon" alt="关闭" class="close-icon">
            </button>
          </div>
        </div>
      </div>
      <!-- 没有更多了 -->
      <div class="no-more-text">没有更多了</div>
    </div>
    </div>

    <!-- 页脚 -->
    <Footer />

    <!-- 注册弹窗 -->
    <RegisterModal 
      :visible="showRegisterModal" 
      @close="showRegisterModal = false"
      @switchToLogin="handleSwitchToLogin"
    />

    <!-- 登录弹窗 -->
    <LoginModal 
      :visible="showLoginModal" 
      @close="showLoginModal = false"
      @switchToRegister="handleSwitchToRegister"
    />

    <!-- 下载确认弹窗 -->
    <DownloadModal
      :visible="showDownloadModal"
      :work-image="workData.src"
      :work-title="workData.title"
      @close="closeDownloadModal"
      @recharge="handleRecharge"
      @confirm="confirmDownload"
    />
  </div>
</template>

<script>
import Header from '@/src/components/Header.vue'
import Footer from '@/src/components/Footer.vue'
import RegisterModal from '@/src/components/RegisterModal.vue'
import LoginModal from '@/src/components/LoginModal.vue'
import DownloadModal from '@/src/components/DownloadModal.vue'

export default {
  name: 'WorkDetailPage',
  components: {
    Header,
    Footer,
    RegisterModal,
    LoginModal,
    DownloadModal
  },
  data() {
    return {
      showRegisterModal: false,
      showLoginModal: false,
      showAdBanner: true,
      showDownloadModal: false,
      workData: {},
      tags: ['关键词', '关键词', '关键词', '关键词', '关键词', '关键词', '关键词', '关键词', '关键词'],
      recommendWorks: [
        { id: '1', src: require('~/assets/images/img/B-01首页_slices/图片位.png'), title: '图片1', author: '烟雨下扬州' },
        { id: '2', src: require('~/assets/images/img/B-01首页_slices/图片位(1).png'), title: '图片2', author: '烟雨下扬州' },
        { id: '3', src: require('~/assets/images/img/B-01首页_slices/图片位(2).png'), title: '图片3', author: '烟雨下扬州' },
        { id: '4', src: require('~/assets/images/img/B-01首页_slices/图片位(3).png'), title: '图片4', author: '烟雨下扬州' },
        { id: '5', src: require('~/assets/images/img/B-01首页_slices/图片位(4).png'), title: '图片5', author: '300分享分' },
        { id: '6', src: require('~/assets/images/img/B-01首页_slices/图片位(5).png'), title: '图片6', author: '烟雨下扬州' },
      ],
      designerWorks: [
        { id: '7', src: require('~/assets/images/img/B-01首页_slices/图片位(6).png'), title: '图片7', author: '烟雨下扬州' },
        { id: '8', src: require('~/assets/images/img/B-01首页_slices/图片位(7).png'), title: '图片8', author: '烟雨下扬州' },
        { id: '9', src: require('~/assets/images/img/B-01首页_slices/图片位(8).png'), title: '图片9', author: '烟雨下扬州' },
        { id: '10', src: require('~/assets/images/img/B-01首页_slices/图片位(9).png'), title: '图片10', author: '烟雨下扬州' },
        { id: '11', src: require('~/assets/images/img/B-01首页_slices/图片位(10).png'), title: '图片11', author: '烟雨下扬州' },
        { id: '12', src: require('~/assets/images/img/B-01首页_slices/图片位(11).png'), title: '图片12', author: '烟雨下扬州' },
      ],
      logoIcon: require('~/assets/images/img/B-01首页_slices/容器 1785.png'),
      idIcon: require('~/assets/images/img/B-02作品_详情页_slices/容器 1791.png'),
      shareIcon: require('~/assets/images/img/B-01首页_slices/金币.png'),
      authorAvatar: require('~/assets/images/img/B-01首页_slices/头像.png'),
      adBannerIcon: require('~/assets/images/img/B-02作品_详情页_slices/容器 1055.png'),
      closeIcon: require('~/assets/images/img/B-01首页_slices/收藏_标签编辑.png'),
      pathIcon: require('~/assets/images/img/B-02作品_详情页_slices/路径 6.png'),
      copyIcon: require('~/assets/images/img/B-02作品_详情页_slices/复制按钮.png'),
      dividerIcon: require('~/assets/images/img/B-02作品_详情页_slices/直线 31.png')
    }
  },
  created() {
    this.loadWorkData()
  },
  methods: {
    loadWorkData() {
      // 从路由参数获取作品ID
      const workId = this.$route.params.id
      
      // 这里应该从API获取作品详情，暂时使用模拟数据
      // 可以根据 workId 从首页的作品列表中查找
      const allWorks = [
        { id: '1', src: require('~/assets/images/img/B-01首页_slices/图片位.png'), title: '图片1', author: '烟雨下扬州' },
        { id: '2', src: require('~/assets/images/img/B-01首页_slices/图片位(1).png'), title: '图片2', author: '烟雨下扬州' },
        { id: '3', src: require('~/assets/images/img/B-01首页_slices/图片位(2).png'), title: '图片3', author: '烟雨下扬州' },
        { id: '4', src: require('~/assets/images/img/B-01首页_slices/图片位(3).png'), title: '图片4', author: '烟雨下扬州' },
        { id: '5', src: require('~/assets/images/img/B-01首页_slices/图片位(4).png'), title: '图片5', author: '300分享分' },
        { id: '6', src: require('~/assets/images/img/B-01首页_slices/图片位(5).png'), title: '图片6', author: '烟雨下扬州' },
        { id: '7', src: require('~/assets/images/img/B-01首页_slices/图片位(6).png'), title: '图片7', author: '烟雨下扬州' },
        { id: '8', src: require('~/assets/images/img/B-01首页_slices/图片位(7).png'), title: '图片8', author: '烟雨下扬州' },
        { id: '9', src: require('~/assets/images/img/B-01首页_slices/图片位(8).png'), title: '图片9', author: '300分享分' },
        { id: '10', src: require('~/assets/images/img/B-01首页_slices/图片位(9).png'), title: '图片10', author: '烟雨下扬州' },
        { id: '11', src: require('~/assets/images/img/B-01首页_slices/图片位(10).png'), title: '图片11', author: '烟雨下扬州' },
        { id: '12', src: require('~/assets/images/img/B-01首页_slices/图片位(11).png'), title: '图片12', author: '烟雨下扬州' },
        { id: '13', src: require('~/assets/images/img/B-01首页_slices/图片位(12).png'), title: '图片13', author: '烟雨下扬州' },
        { id: '14', src: require('~/assets/images/img/B-01首页_slices/图片位(13).png'), title: '图片14', author: '烟雨下扬州' },
        { id: '15', src: require('~/assets/images/img/B-01首页_slices/图片位(14).png'), title: '图片15', author: '烟雨下扬州' },
        { id: '16', src: require('~/assets/images/img/B-01首页_slices/图片位(15).png'), title: '图片16', author: '烟雨下扬州' },
        { id: '17', src: require('~/assets/images/img/B-01首页_slices/图片位(16).png'), title: '图片17', author: '烟雨下扬州' },
        { id: '18', src: require('~/assets/images/img/B-01首页_slices/图片位(17).png'), title: '图片18', author: '烟雨下扬州' },
        { id: '19', src: require('~/assets/images/img/B-01首页_slices/图片位(18).png'), title: '图片19', author: '烟雨下扬州' },
        { id: '20', src: require('~/assets/images/img/B-01首页_slices/图片位(19).png'), title: '图片20', author: '烟雨下扬州' },
        { id: '21', src: require('~/assets/images/img/B-01首页_slices/图片位(20).png'), title: '图片21', author: '300分享分' },
        { id: '22', src: require('~/assets/images/img/B-01首页_slices/图片位(21).png'), title: '图片22', author: '300分享分' },
        { id: '23', src: require('~/assets/images/img/B-01首页_slices/图片位(22).png'), title: '图片23', author: '烟雨下扬州' },
        { id: '24', src: require('~/assets/images/img/B-01首页_slices/图片位(23).png'), title: '图片24', author: '烟雨下扬州' },
      ]
      
      const work = allWorks.find(w => w.id === workId) || allWorks[0]
      this.workData = {
        ...work,
        id: workId
      }
    },
    handleDownload() {
      this.showDownloadModal = true
    },
    closeDownloadModal() {
      this.showDownloadModal = false
    },
    handleRecharge() {
      // 处理充值逻辑
      console.log('跳转到充值页面')
    },
    confirmDownload() {
      // 处理确认下载逻辑
      console.log('确认下载作品')
      this.showDownloadModal = false
      this.$message.success('下载成功')
    },
    handleCollect() {
      // 处理收藏逻辑
      console.log('收藏作品')
    },
    handleCopyId() {
      const workId = this.workData.id || this.$route.params.id
      // 复制到剪贴板
      if (navigator.clipboard && navigator.clipboard.writeText) {
        navigator.clipboard.writeText(workId).then(() => {
          this.$message.success('ID已复制到剪贴板')
        }).catch(() => {
          this.fallbackCopyText(workId)
        })
      } else {
        this.fallbackCopyText(workId)
      }
    },
    fallbackCopyText(text) {
      // 兼容旧浏览器的复制方法
      const textArea = document.createElement('textarea')
      textArea.value = text
      textArea.style.position = 'fixed'
      textArea.style.left = '-999999px'
      document.body.appendChild(textArea)
      textArea.select()
      try {
        document.execCommand('copy')
        this.$message.success('ID已复制到剪贴板')
      } catch (err) {
        this.$message.error('复制失败，请手动复制')
      }
      document.body.removeChild(textArea)
    },
    handleSwitchToLogin() {
      this.showRegisterModal = false
      this.showLoginModal = true
    },
    handleSwitchToRegister() {
      this.showLoginModal = false
      this.showRegisterModal = true
    },
    closeAdBanner() {
      this.showAdBanner = false
    },
    handleImageClick(item) {
      const workId = item.id || (this.recommendWorks.indexOf(item) + 1).toString()
      this.$router.push(`/works/${workId}`)
    }
  }
}
</script>

<style scoped>
.work-detail-page {
  min-height: 100vh;
  background: #f5f5f5;
}

.work-detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.breadcrumb {
  margin-bottom: 15px;
  font-size: 12px;
  color: #666;
}

.breadcrumb a {
  color: #333;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: #19D8B6;
}

.breadcrumb .separator {
  margin: 0 8px;
}

.work-detail-content {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
}

.work-detail-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.work-image-section {
  flex-shrink: 0;
}

.work-image-wrapper {
  position: relative;
  background: white;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  width: 730px;
  height: 583px;
}

.work-main-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.work-id {
  position: absolute;
  bottom: 7px;
  right: 32px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: white;
}

.id-icon {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.work-attribution {
  font-size: 12px;
  color: #999;
  text-align: left;
  margin-left: 30px;
}

.work-info-section {
  width: 230px;
  flex-shrink: 0;
}

.work-info-content {
  background: white;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
}

.work-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.work-id-title-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 20px;
}

.work-id-title {
  font-size: 14px;
  color: #666;
}

.copy-btn {
  width: 14px;
  height: 14px;
  cursor: pointer;
  transition: opacity 0.3s;
  flex-shrink: 0;
}

.copy-btn:hover {
  opacity: 0.7;
}

.complain-link {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #19D8B6;
  cursor: pointer;
  padding: 2px 6px;
  border: 1px solid #B3B3B3;
  border-radius: 20px;
  transition: all 0.3s;
}

.complain-link:hover {
  opacity: 0.8;
}


.work-title {
  font-size: 18px;
  color: #2E2E30;
  font-weight: 400;
  margin-bottom: 15px;
  line-height: 2.2;
}

.share-points-info {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 20px;
}

.share-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.share-points-number {
  font-size: 22px;
  color: #2E2E30;
  font-weight: 500;
  font-family: 'Source Han Sans', 'Source Han Sans', sans-serif;
  line-height: 1;
}

.share-points-text {
  font-size: 13px;
  color: #2E2E30;
  align-self: center;
}

.file-info {
  padding: 10px 0;
  margin-bottom: 15px;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-label {
  color: #B3B3B3;
}

.info-separator {
  color: #B3B3B3;
  margin: 0 8px;
}

.info-value {
  color: #666;
}

.info-value-highlight {
  color: #19D8B6;
}

.action-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 20px;
}

.download-btn {
  flex: 1;
  background: #19D8B6;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s;
}

.download-btn:hover {
  background: #16c5a5;
}

.collect-btn {
  flex: 1;
  background: white;
  color: #19D8B6;
  border: 1px solid #19D8B6;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.tips-box {
  background: #F5F5F5;
  padding: 10px;
  border-radius: 4px;
  font-size: 11px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.4;
}

.tips-label {
  color: #19D8B6;
}

.author-section {
  padding: 0;
  margin-bottom: 0;
}

.author-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.author-avatar-large {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-info {
  flex: 1;
}

.author-name-large {
  font-size: 14px;
  color: #2E2E30;
  margin-bottom: 6px;
}

.author-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.author-level-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.author-level {
  font-size: 12px;
  color: #19D8B6;
}

.author-role {
  font-size: 12px;
  color: #B3B3B3;
}

.follow-btn {
  background: #19D8B6;
  color: white;
  border: none;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
  white-space: nowrap;
}

.follow-btn:hover {
  background: #16c5a5;
}

.ticket-divider {
  width: calc(100% + 30px);
  height: 1px;
  border-top: 1px solid #f5f5f5;
  margin: 20px -15px;
  position: relative;
}

.ticket-divider::before,
.ticket-divider::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #F5F5F5;
  border-radius: 50%;
  top: -6px;
}

.ticket-divider::before {
  left: -6px;
}

.ticket-divider::after {
  right: -6px;
}

.author-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 15px 0;
}

.stat-item-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.stat-number {
  font-size: 16px;
  color: #666;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: #B3B3B3;
}

.stat-divider {
  width: 1px;
  height: 30px;
  object-fit: contain;
  margin: 0 10px;
  flex-shrink: 0;
}

.stat-item {
  cursor: pointer;
}

.stat-item:hover {
  color: #19D8B6;
}

.ad-banner {
  position: relative;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.ad-image {
  width: 100%;
  height: auto;
  display: block;
}

.ad-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.3s;
  z-index: 10;
}

.ad-close-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.close-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.material-tags-section {
  padding: 20px 0;
  width: 730px;
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  font-size: 24px;
  color: #2E2E30;
  margin-bottom: 15px;
}

.path-icon {
  width: auto;
  height: 21px;
  margin-right: 12px;
  object-fit: contain;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-item {
  padding: 4px 18px;
  background: white;
  border-radius: 20px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
}

.tag-item:hover {
  background: #19D8B6;
  color: white;
}

.recommend-section {
  width: 730px;
  margin-top: 40px;
}

.recommend-grid {
  column-count: 3;
  column-gap: 20px;
  margin-top: 20px;
}

.recommend-item {
  break-inside: avoid;
  margin-bottom: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.recommend-item:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.recommend-image-wrapper {
  width: 100%;
  overflow: hidden;
}

.recommend-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.recommend-info {
  padding: 15px;
  background: white;
  display: flex;
  flex-direction: column;
}

.recommend-title {
  font-size: 14px;
  color: #333;
  margin-bottom: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.recommend-author-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
}

.recommend-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recommend-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recommend-author-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recommend-author-name-row {
  display: flex;
  align-items: center;
}

.recommend-author-name {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

.recommend-author-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recommend-author-level {
  font-size: 12px;
  color: #19D8B6;
  font-weight: 500;
}

.recommend-author-role {
  font-size: 12px;
  color: #999;
}

.recommend-share-points {
  font-size: 12px;
  color: #333;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.recommend-coin-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  max-width: 18px;
  max-height: 18px;
  object-fit: contain;
}

.no-more-text {
  text-align: center;
  padding: 40px 0;
  color: #999;
  font-size: 14px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 1200px) {
  .work-detail-content {
    flex-direction: column;
  }
  
  .work-info-section {
    width: 100%;
  }
}
</style>

